package cn.bluemobi.app.controller.merchant;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.bluemobi.app.core.controller.AppBaseController;
import cn.bluemobi.app.entity.output.Merchant;
import cn.bluemobi.app.service.MerchantService;
import cn.bluemobi.common.core.dto.Dto;
import cn.bluemobi.common.core.dto.Page;

import com.wordnik.swagger.annotations.Api;
import com.wordnik.swagger.annotations.ApiOperation;
import com.wordnik.swagger.annotations.ApiParam;

/**
 * 
 * @author lvxh
 * 
 */
@Controller
@RequestMapping("/merchant")
@Api(description = "商户", value = "merchant")
public class MerchantController extends AppBaseController {

	@Autowired
	private MerchantService merchantService;

	@ApiOperation(value = "商户列表", httpMethod = "POST")
	@RequestMapping("/findMerchantList")
	@ResponseBody
	public Page<Merchant> findMerchantList(
			@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
			@RequestParam(value = "pageSize", defaultValue = "20") Integer pageSize) {
		return merchantService.findMerchantList(pageNo, pageSize);
	}

	@ApiOperation(value = "商户详情", httpMethod = "POST")
	@RequestMapping("/findMerchantDetail")
	@ResponseBody
	public Dto<Merchant> findMerchantDetail(
			@ApiParam("会员ID") @RequestParam(value = "memberId", required = false) String memberId,
			@ApiParam("商户ID") @RequestParam("merchantId") String merchantId) {
		return merchantService.findMerchantDetail(memberId, merchantId);
	}

}
